#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 1e4 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
ll f[N];
void find_f()
{
    f[1] = f[2] = 1;
    for (int i = 3; i <= N; i++)
    {
        f[i] = (f[i - 1] + f[i - 2])%10086;
    }
}
int main()
{
    close();
    find_f();

    ll m;
    cin>>m;

    ll ans=1;
    for(int i=2;i<m;i++)
    {
    	if(m%i==0) ans+=f[i];
    }

    ans=ans&10086;
    cout<<ans<<'\n';


    return 0;
}